package com.loto.webapp.bo.impl;

import com.loto.webapp.bo.UserBo;
import com.loto.webapp.common.PageResultSet;
import com.loto.webapp.dao.UserDao;
import com.loto.webapp.model.User;
import com.loto.webapp.util.MD5;

public class UserBoImpl implements UserBo {

	UserDao userDao;

	public void setUserDao(UserDao UserDao) {
		this.userDao = UserDao;
	}

	public Boolean login(String username, String password) {
		User user = userDao.findByUsername(username);
		if (user != null
				&& user.getUserPassword().toUpperCase()
						.equals(MD5.getMD5Str(password).toUpperCase()))
			return true;
		else
			return false;
	}

	public PageResultSet<Object> getUserList(int pageSize, int pageIndex) {
		return userDao.getUserList(pageSize, pageIndex);
	}

}